<?php

namespace app\home\controller;
use think\Controller;
use think\Db;
use think\Session;
use think\request;

/**
 *
 * 信息
 */
class Message extends Base{
    public function index()
    {
		//站内信
    	$data=Db::name('message')->alias('a')
    	      ->join('qfll_messagetest b ','a.messageID=b.id')
    	      ->where('a.rceID',Session::get('uid'))
    	      ->where('a.level',3)
    	      ->field('a.id,a.Statue,b.title,b.ptime,b.message')
    	      ->order('a.id desc')
    	      ->paginate(4);
    	      $page=$data->render();
    	      $this->assign('data', $data);
              $this->assign('page', $page);
        return view('Message/notification');
    }
    
    public  function  contes()
    {
	  $id=$_GET['id'];
	  //站内信
	  $data=Db::name('message')->alias('a')
	      ->join('qfll_messagetest b ','a.messageID=b.id')
	      ->where('a.id',$id)
	      ->field('a.id,a.Statue,b.title,b.ptime,b.message')
	      ->find();
	      $this->assign('data',$data);
        //用户未读的站内信改
        Db::table('qfll_message')->where('id',$id)->setField('Statue',1);
      return view('Message/content');
    }
    
}